import urllib.request
from bs4 import BeautifulSoup
import ssl

# Ignore ssl certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

url = input('Enter a url address(default https://docs.python.org): ')
if url == '':
    url = 'https://docs.python.org'

html = urllib.request.urlopen(url=url, context=ctx).read()
soup = BeautifulSoup(html, 'html.parser')

# get all tags for the html document.
tags = soup('a')
# print(tags)

for tag in tags:
    print(tag.get('href', None))

# print(soup)
